package cn.pfz.domain;

import lombok.*;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class JsonResult <T>{
    private Integer code;
    private String msg;
    private Boolean success;
    private T data;

    public static <T>JsonResult success(T data){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setSuccess(true);
        jsonResult.setData(data);
        return jsonResult;
    }

    public static <T>JsonResult erro(String msg){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setSuccess(false);
        jsonResult.setMsg(msg);
        return jsonResult;
    }
}
